MyGame.s1 = function(game) {
	
	

};


MyGame.s1.prototype = {
    create: function() {

    	var that = this;
    	
		game.bg = game.add.image(game.world.centerX,0,'s1_bg');
        game.bg.anchor.set(0.5,0)

        
        game.logo = game.add.image(-294,265,'logo');
        game.zi = game.add.image(161,373,'s1_zi');
        game.bg.addChild(game.logo)

        game.chart_1 = game.add.image(161,303,'s1_chart_1');
        game.chart_1.alpha = 0;
        game.chart_1.inputEnabled = false;
        

        game.chart_2 = game.add.image(161,303,'s1_chart_2');
        game.chart_2.alpha = 0;
        game.chart_2.inputEnabled = false;

        game.touch_text = game.add.image(game.world.centerX,game.world.centerY-30,'touch_text');
        game.touch_text.anchor.set(0.5);
        game.touch_text.scale.x = game.touch_text.scale.y = 0.6
        game.touch_text.alpha = 0;
        game.touch_text.visible = false;



        
        






        
        game.add.tween(game.touch_text).to({alpha:[1,0]},1000,Phaser.Easing.Cubic.Out,true,2000,-1)





        game.add.tween(game.zi).from({alpha:0},1000,Phaser.Easing.Cubic.Out,true,1000).onComplete.add(function(){

            game.time.events.add(Phaser.Timer.SECOND * 12, function(){
                game.touch_text.visible = true
            })


            game.add.tween(game.zi).to({alpha:0,y:'-20'},1000,Phaser.Easing.Cubic.Out,true,1000).onComplete.add(function(){

                loadOtherChart('p1_1',function(){
                    game.logo.alpha = 0
                    $('#p1_1').hide();
                    setTimeout(function(){
                        $('#p1_1').css({
                            opacity : 0
                        })
                    },0)
                    game.touch_text.visible = false;

                    game.add.tween(game.chart_1).to({alpha:1},1000,Phaser.Easing.Cubic.Out,true,0).onComplete.add(function(){

                        

                        game.time.events.add(Phaser.Timer.SECOND * 2, function(){

                            game.chart_1.visible = false;
                            game.time.events.add(Phaser.Timer.SECOND * 8, function(){
                                game.touch_text.visible = true
                            })


                            loadOtherChart('p1_2',function(){
                                $('#p1_2').hide();
                                setTimeout(function(){
                                    $('#p1_2').css({
                                        opacity : 0
                                    })
                                },0)
                                game.touch_text.visible = false;

                                game.add.tween(game.chart_2).to({alpha:1},1000,Phaser.Easing.Cubic.Out,true,0).onComplete.add(function(){

                                    game.chart_2.inputEnabled = true;

                                    game.touch_text2 = game.add.image(game.world.centerX,game.world.centerY-30,'touch_text');
                                    game.touch_text2.anchor.set(0.5);
                                    game.touch_text2.scale.x = game.touch_text2.scale.y = 0.6
                                    game.touch_text2.alpha = 0;
                                    game.touch_text2.inputEnabled = true;

                                    game.add.tween(game.touch_text2).to({alpha:[1,0]},1000,Phaser.Easing.Cubic.Out,true,2000,-1)



                                    game.touch_text2.events.onInputDown.add(function(){
                                        game.chart_2.visible = false

                                        that.change()
                                    })
                                
                                })


                                //that.change()
                            })
            
                           
                        })


                    })


                })


                

                

                //that.change()
            // }, this);

                

            })


            //点击图注2
            game.chart_2.events.onInputDown.add(function(){

                
                game.chart_2.visible = false

                that.change()

                
            }, this);
            



            
        })


        GameUI.cutscenes()

        return;


        
        

        GameUI.cutscenes()
        

       

    },
    update: function() {
    	
    	
    	
    },

    change:function(){
        game.add.tween(game.bg.scale).to({x:2.5,y:2.5},1000,Phaser.Easing.Cubic.Out,true,0)
        game.add.tween(game.bg).to({x:'+150',y:'-300'},1000,Phaser.Easing.Cubic.Out,true,0).onComplete.add(function(){
            game.state.start('s2')
        })
        GameUI.scenesfadeOut(2000,0)
    },
    
    
    
    render : function(){
    	/*game.obstacles.forEach(function(item){
            game.debug.body(item);
        })
    	game.debug.body(game.player);*/
    }
};

